﻿
@{
    ViewBag.Title = "修改密码";
}
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>修改密码</legend>
</fieldset>

<form class="layui-form" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">旧密码</label>
        <div class="layui-input-block">
            <input type="Password" name="OldPassword" lay-verify="required" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="Password" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="ConfirmPassword" lay-verify="required" placeholder="请输入确定密码" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">确定</button>
        </div>
    </div>
</form>

@section scripts{
    <script>
        layui.use(['form', 'layedit'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit;

            //监听提交
            form.on('submit(demo1)', function (data) {
                $.post("@Url.Action("ChangePwd")", data.field, function (result) {
                    if (result.success) {
                        layer.msg(result.message, {
                            icon: 1
                            , time: 1000
                        }, function () {
                            location.href = '@Url.Action("Login","Account")';
                        });
                    } else {
                        layer.msg(result.message, { icon: 2 });
                    }
                });
                return false;
            });


        });
    </script>

}